/*
 * @Author: your name
 * @Date: 2020-10-27 21:06:58
 * @LastEditTime: 2020-10-28 00:00:23
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \就业班练习d:\桌面\ma-pc\src\api\image.js
 */
import axios from '@/utils/request'
/**
 * @description:获取素材数据
 * @param {Boolean} collect 是否是收藏的图片
 * @param {page} page 页数
 * @param {per_page} per_page 每页显示数量
 * @return {Promise}
 */
export const getImageList = (params) => {
  return axios({
    url: 'mp/v1_0/user/images',
    method: 'GET',
    params
  })
}
/**
 *  @description:切换收藏图片
 * @param {Number} id 图片的编号
 * @param {Boolean} collect  是否收藏
 */
export const switchCollect = (id, collect) => {
  return axios({
    method: 'PUT',
    url: '/mp/v1_0/user/images/' + id,
    data: {
      collect
    }
  })
}

/**
 * @description:删除图片
 * @param {Number} id 图片编号
 */
export const deleteImage = id => axios({
  method: 'DELETE',
  url: '/mp/v1_0/user/images/' + id
})
/**
 * @description: 上传素材
 * @param {*}
 * @return {Promise}
 */
// export const upImg = (image) => axios({
//   method: 'POST',
//   url: 'mp/v1_0/user/images',
//   body: image
// })
